﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace KLTP2UI
{
	static class DllMem
	{
		[DllImport("MemMan.dll")]
		public static extern void MmInitialize();
		
		[DllImport("MemMan.dll")]
		public static extern void MmDeInitialize();
		
		[DllImport("MemMan.dll")]
		public static extern void MmReInitialize();

		[DllImport("MemMan.dll")]
		public static extern bool MmIsInitialized();


		
		[DllImport("MemMan.dll")]
		public static extern uint GetThreadsCountTotal();

		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern uint GetThreadIndexForId(short threadId);

		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern short GetThreadIdForIndex(uint threadIdx);

		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern uint GetThreadEventsCount(uint threadIdx);
		


		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr GetEventTime(uint threadIdx, uint eventIdx);

		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern byte GetEventType(uint threadIdx, uint eventIdx);
		//See CMemMan::GetTypeFast() for details

		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr GetEventService(uint threadIdx, uint eventIdx);

		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr GetEventMessage(uint threadIdx, uint eventIdx);
		
		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)]
		public static extern void GetEventMessageEx(uint threadIdx, uint eventIdx, StringBuilder outBuffer);
		

		
		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)] 
		public static extern void AddString(string constData);
		
		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)] 
		public static extern uint AddBlock(IntPtr changeableData);



		[DllImport("MemMan.dll", CallingConvention = CallingConvention.Cdecl)] 
		public static extern uint ParseBack(IntPtr constData, uint sizeInBytes);
   }
}
